#include<cstdio>//uncle-lu
#include<algorithm>
template<class T>void read(T &x)
{
	x=0;int f=0;char ch=getchar();
	while(ch<'0'||ch>'9') { f|=(ch=='-'); ch=getchar(); }
	while(ch<='9'&&ch>='0') { x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); }
	x = f ? -x : x;
	return ;
}

int b[7]={0, 1, 2, 3, 5, 10, 20};
int w[1010];
int F[1010];

int main()
{
	int sum = 0, cnt = 0, k;
	for (int i = 1; i <= 6; i++) 
	{
		read(k);
		int temp = 1;
		while(temp < k)
		{
			w[++cnt] = b[i] * temp;
			sum += b[i] * temp;
			k -= temp;
			temp <<= 1;
		}
		if(k != 0)
		{
			w[++cnt] = b[i] * k;
			sum += b[i] * k;
		}
	}

	F[0] = 1;
	for (int i = 1; i <= cnt; i++) 
		for(int j=sum; j>=w[i]; --j)
			if(F[j-w[i]])F[j] = 1;

	int ans = 0;
	for (int i = 1; i <= 1000; i++) 
		if(F[i])ans++;

	printf("Total=%d", ans);
	return 0;
}
